import { IEventHandler } from "../../ADCore/Interfaces/IUtils";

export default class EventHandler implements IEventHandler {
    private handler: Laya.Handler;
    
    constructor(caller?: any, method?: Function, args?: any[], once?: boolean){
        if(method){
            this.handler = Laya.Handler.create(caller, method, args, once);
        }
    }
    run() {
        return  this.handler.run();
    }
    runWith(data:any) {
       return  this.handler.runWith(data); 
    }
    create(caller: any, method: Function, args?: any[], once?: boolean): IEventHandler {
        this.handler = Laya.Handler.create(caller, method, args, once);
        return this;
    }

}